1. /* srmrput.cpp by K.Tsuru */
  2. // function ID = 840 BARDIX
  3. /*******************************************
  4. SRational class
  5. It outputs to the present stream.
  6. It converts num and den(SInteger) to SLong.
  7. ********************************************/
  8. #ifndef SN_H
  9. #include "sn.h"
  10. #endif
  11. long SRational::Put(int fig, char delmt, int mode) {
  12. reduce(true);
  13. long p = 0;
  14. if(mode & BRACKET){
  15. num.FPutc('('); p = 2; // ()
  16. }
  17. if( den.IsOne() ){ //denominator is one
  18. p += num.Put(fig, 0, 0, delmt); // SInteger class's menber
  19. } else {
  20. p += num.Put(fig, 0, 0, delmt);
  21. num.FPutc('/'); p++;
  22. p += den.Put(fig, 0, 0, delmt);
  23. }
  24. if(mode & BRACKET) num.FPutc(')');
  25. if(mode & END_CR){ num.FPutc('\n'); p++; }
  26. return p;
  27. }

srmrput.cpp : last modifiled at 2016/06/30 14:51:16(749 bytes)
created at 2016/06/26 15:57:35
The creation time of this html file is 2016/09/18 20:28:05 (Sun Sep 18 20:28:05 2016).